package com.platform.common.entity;

import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * @author: yuanlai
 * @since 2022/10/19
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ApiPageResponse<T extends Serializable> implements Serializable {
    @ApiModelProperty("当前页")
    private long pageNumber;
    @ApiModelProperty("每页显示大小")
    private long pageSize;
    @ApiModelProperty("数据总条数")
    private long totalCount;
    @ApiModelProperty("当前页数据")
    private List<T> items = new ArrayList<>();

    public static <T> ApiPageResponse getInstance(
            long pageNumber, long pageSize, long totalCount, List<T> items) {
        return new ApiPageResponse(pageNumber, pageSize, totalCount, items);
    }

}
